﻿using J.FoodManageSet.Application.Command.BenchTableCommand;
using J.FoodManageSet.Application.Command.DishesCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace J.FoodManageSet.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DishesController : ControllerBase
    {
        private readonly IMediator _mediator;

        public DishesController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 菜品添加或修改
        /// </summary>
        [HttpPost]
        public async Task<int> DishesAddUpdate(DishesAddUpDateCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品删除
        /// </summary>
        [HttpPost]
        public async Task<int> DishesDelete(DishesDeleteCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品开启关闭
        /// </summary>
        [HttpPost]
        public async Task<int> DishesOpen(DishesOpenCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品开启
        /// </summary>
        [HttpPost]
        public async Task<int> DishesOpens(DishesShut command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品关闭
        /// </summary>
        [HttpPost]
        public async Task<int> DishesShut(DishesShutCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品修改字段
        /// </summary>
        [HttpPost]
        public async Task<int> DishesOpenUpate(DishesOpenUpDateCommand command)
        {
            return await _mediator.Send(command);
        }

    }
}
